import java.util.*;
 public class Calendar
{
   public static void main (String[] arg)
   {
       Scanner in = new Scanner(System.in);
       System.out.print ("Write day:");
       int day = in.nextInt();

           if ((day<0) || (day>31))
              {
              System.out.print ("Wrong day number");
              return;
              }
       System.out.print ("Write month:");
       int month = in.nextInt();

            if ((month<0) || (month>12))
              {
              System.out.print ("Wrong month number");
              return;
              }
       System.out.print ("Write year:");
       int year = in.nextInt();

            if (year<0)
              {
              System.out.print ("Wrong year number");
              return;
              }          

       int a = (14 - month) / 12;
       int y = year - a;
       int m = month + 12*a-2;

       int DN = (7000+(day+y+y/4-y/100+y/400+(31*m)/12))%7;
       switch (DN)
          {
             case 0:
		System.out.print ("Sunday");
                break;
             case 1:
		System.out.print ("Monday");
                break;
             case 2:
		System.out.print ("Tuesday");
                break;
             case 3: 
            	System.out.print ("Wednesday");
                break;
             case 4: 
            	System.out.print ("Thursday");
                break;
             case 5:  
       		System.out.print ("Friday");
                break;
             case 6:
                System.out.print ("Saturday");
                break; 
           }
     }
}